local cheji = fk.CreateSkill({
    name = "sj4__cheji",
})
  
Fk:loadTranslationTable{
  ["sj4__cheji"] = "掣疾",
  [":sj4__cheji"] = "出牌阶段限一次，你可以视为使用一张目标唯一的伤害牌。<br>背水:此法最后受到伤害的角色摸两张牌。",

  ["#sj4__cheji"] = "你可以视为使用一张目标唯一的伤害牌",
  ["#sj4__cheji-bs"] = "背水:此法最后受到伤害的角色摸两张牌",

  ["$sj4__cheji1"] = "两阵相临，必有一战。",
  ["$sj4__cheji2"] = "先登攻城，以立战功。",
}

cheji:addEffect("active", {
  prompt = "#sj4__cheji",
  interaction = function (self, player)
    local all = table.filter(Fk:getAllCardNames("bt"),function (n)
      local card = Fk:cloneCard(n)
      return card.is_damage_card and not card.multiple_targets
    end)
    local ask = table.filter(all,function (n)
      return #Fk:cloneCard(n):getDefaultTarget(player,{bypass_times = true}) > 0
    end)
    if #ask > 0 then
      table.insert(ask,"#sj4__cheji-bs")
      table.insert(all,"#sj4__cheji-bs")
    end
    return UI.ComboBox {
      choices = ask,
      all_choices = all,
    }
  end,
 can_use = function(self, player)
   return player:usedSkillTimes(cheji.name, Player.HistoryPhase) < 1
 end,
 card_filter = Util.FalseFunc,
 target_filter = Util.FalseFunc,
 feasible = function (self, player, selected, selected_cards, card)
  return self.interaction.data ~= nil
 end,
 on_use = function(self, room, effect)
   local player = effect.from
   if self.interaction.data == "#sj4__cheji-bs" then
    local all = table.filter(Fk:getAllCardNames("bt"),function (n)
      local card = Fk:cloneCard(n)
      return card.is_damage_card and not card.multiple_targets
    end)
    local ask = table.filter(all,function (n)
      return #Fk:cloneCard(n):getDefaultTarget(player,{bypass_times = true}) > 0
    end)
    local list = {}
    for _, name in ipairs(ask) do
      local card = Fk:cloneCard(name)
      if not table.find(list,function (t)
        return table.find(t,function (n)
          return Fk:cloneCard(n).trueName == card.trueName
        end)
      end) then
        table.insert(list,table.filter(ask,function (n)
          return Fk:cloneCard(n).trueName == card.trueName
        end))
      end
    end
    for _, t in ipairs(list) do
      room:askToUseVirtualCard(player,{
        name = t,
        skill_name = cheji.name,
        cancelable = false,
       })
    end
    room.logic:getEventsByRule(GameEvent.Damage,1,function (e)
      if e.data.card and e.data.card.skillName == cheji.name then
        if not e.data.to.dead then
          e.data.to:drawCards(2,cheji.name)
        end
        return true
      end
    end,nil,Player.HistoryPhase)
   else
    room:askToUseVirtualCard(player,{
      name = self.interaction.data,
      skill_name = cheji.name,
      cancelable = false,
     })
   end
 end,
})

  return cheji